Jonas Bernoulli [Thu, 4 Aug 2022 12:05:11 +0000 (14:05 +0200)]
Fix vertical off-by-one error
When the usage information is displayed at the top or bottom (as
controlled by `which-key-show-prefix'), then we already accounted
for that by putting (- max-height 1) bindings in each row. But
we did not ensure that the max-height is used when displaying the
result. Instead we used (- max-height 1) here too.
When trying to display usage information at the bottom, the result is
that it is not displayed because it is off-window. When displaying at
the top, then it is displayed, but the last binding is off-window and
never displayed.
This bug did not matter (much) when using the default settings because
then the code used for displaying the window actually ignores the
max-height and just uses the height appropriate to display all lines
in the buffer (i.e., (+ max-height 1)). However, other display
methods, including but not necessarily limited to third-party methods
(such as `which-key-posframe') may choose to, or absolutely have to,
respect max-height. In particular, anything that tries to use the
full height of a frame or window, will be affected by this.
Jonas Bernoulli [Thu, 4 Aug 2022 12:05:09 +0000 (14:05 +0200)]
Fix horizontal off-by-one error
Delay increasing width used by columns until we know that we have to
do so because we have determined that there is enough room to add an
additional column and a space between the last two columns.
If we don't do that, then we can easily get an off-by-one error. If
docstrings are shown and the window is narrow, then it is likely that
we end up using the maximal width. If we then add one to the actual
width and later compare that again with the maximal width, then that
is too width.
Jonas Bernoulli [Thu, 4 Aug 2022 12:05:08 +0000 (14:05 +0200)]
Don't pad beyond maximal width
The old implementation behaved as if the "description" is the only
information that is being displayed, however in actuality the
available width has to be shared with the key (and the separator
between the two).
Failing to take that into account meant that every binding whose
description isn't *by itself* wider than the width available to
display all the information got excessive padding, which later has to
be removed during truncation again (resulting in misleading ellipses).
Jonas Bernoulli [Thu, 4 Aug 2022 12:05:07 +0000 (14:05 +0200)]
Displaying just one column means pages are arranged vertically
Third-party display methods may do that without using a side-window,
and therefore they don't set `which-key-popup-type' to `side-window'.
Likewise they might not set `which-key-side-window-location', e.g.,
because their display method only supports one location.
`which-key-max-display-columns' being 1 is by itself already enough
of an indicator to know that there won't be multiple columns.
Jonas Bernoulli [Thu, 4 Aug 2022 12:05:06 +0000 (14:05 +0200)]
Calculate format string only once
Justin Burkett [Wed, 18 May 2022 19:41:11 +0000 (15:41 -0400)]
Add group to minor-mode definition
Fixes #339
Justin Burkett [Tue, 19 Apr 2022 02:27:45 +0000 (22:27 -0400)]
Merge remote-tracking branch 'origin/master'
Justin Burkett [Tue, 19 Apr 2022 02:26:35 +0000 (22:26 -0400)]
Add an example to README for keymap binding
See #338
Justin Burkett [Mon, 14 Feb 2022 18:18:32 +0000 (13:18 -0500)]
Bump version
Justin Burkett [Mon, 14 Feb 2022 03:33:02 +0000 (22:33 -0500)]
Don't allow transient maps when prefix length is zero.
Fixes #335
Justin Burkett [Sun, 2 Jan 2022 14:33:02 +0000 (09:33 -0500)]
Fix typo in ellipsis
Justin Burkett [Sun, 2 Jan 2022 04:28:19 +0000 (23:28 -0500)]
Merge pull request #329 from hans-d/feat-elipsis
add which-key-elipsis
Justin Burkett [Sun, 2 Jan 2022 04:26:37 +0000 (23:26 -0500)]
Merge branch 'feat-columnsize'
Justin Burkett [Sun, 2 Jan 2022 04:25:59 +0000 (23:25 -0500)]
Fix code column width
Justin Burkett [Sun, 2 Jan 2022 04:11:21 +0000 (23:11 -0500)]
Merge pull request #331 from skangas/gnu-elpa-badge
Add GNU ELPA badge
Stefan Kangas [Sat, 1 Jan 2022 00:38:56 +0000 (01:38 +0100)]
Add GNU ELPA badge to README.org
Hans Donner [Fri, 24 Dec 2021 19:00:51 +0000 (20:00 +0100)]
add which-key-elipsis
Hans Donner [Fri, 24 Dec 2021 07:26:04 +0000 (08:26 +0100)]
add which-key-min-column-description-width
Justin Burkett [Tue, 14 Dec 2021 02:27:32 +0000 (21:27 -0500)]
Update to the newer advice API
Patch submitted by Stefan Monnier
Justin Burkett [Thu, 9 Dec 2021 04:57:20 +0000 (23:57 -0500)]
Fix key-chord handling
It turns out we don't need to do anything too tricky for key-chords, because
this-single-command-raw-keys returns the correct key-sequence
Fixes #254
Justin Burkett [Fri, 26 Nov 2021 03:45:35 +0000 (22:45 -0500)]
Respect which-key-min-display-lines setting
Fixes #325
Justin Burkett [Fri, 26 Nov 2021 02:32:18 +0000 (21:32 -0500)]
Allow binding to symbols in which-key-C-h-dispatch
Fixes #326
Justin Burkett [Fri, 26 Nov 2021 02:00:25 +0000 (21:00 -0500)]
Merge pull request #327 from anis-semmar/patch-1
README.org: fix page flipping command names
Justin Burkett [Fri, 26 Nov 2021 01:58:22 +0000 (20:58 -0500)]
Merge pull request #321 from fredericgiquel/preserve-window-configuration
Preserve window configuration
anis-semmar [Thu, 18 Nov 2021 16:30:41 +0000 (17:30 +0100)]
README.org: fix page flipping command names
`which-key-show-next-page` / `which-key-show-previous-page` do not exist, state the correct command name.
Justin Burkett [Tue, 24 Aug 2021 00:11:35 +0000 (20:11 -0400)]
Merge pull request #323 from Zetagon/master
Add missing argument to function call
Leo Okawa Ericson [Mon, 23 Aug 2021 11:01:01 +0000 (13:01 +0200)]
Add missing argument to function call
Frédéric Giquel [Wed, 18 Aug 2021 08:17:28 +0000 (10:17 +0200)]
Add option (default off) to restore window configuration
Justin Burkett [Tue, 17 Aug 2021 17:35:22 +0000 (13:35 -0400)]
Merge pull request #313 from duncanburke/master
Add support for help-char being a generalized input event
Frédéric Giquel [Fri, 30 Jul 2021 16:06:29 +0000 (18:06 +0200)]
Preserve window configuration
Justin Burkett [Wed, 28 Jul 2021 01:50:13 +0000 (21:50 -0400)]
Merge pull request #315 from peniblec/keymap-names
Fix some keymap names not showing up
Kévin Le Gouguec [Sun, 18 Jul 2021 16:53:14 +0000 (18:53 +0200)]
Fix some keymap names not showing up
Closes #314.
Duncan Burke [Tue, 13 Jul 2021 15:24:05 +0000 (01:24 +1000)]
Add support for help-char being a generalized input event
Not all keyboard events can be represented as a character. For example,
while ?\C-h is a character, represented as 8 in decimal, C-M-h is
represented by
134217736 in decimal, as can be obtained from:
(elt (kbd "C-M-h") 0)
It is useful to allow help-char to be set to something other than a
character, as characters cover only a very small region of possible
input events. This is especially important because help-char is used to
bring up the pagination menu (when which-key-use-C-h-commands is t), and
this won't work if it conflicts with any keybinding within the prefix
command that led to the activation of which-key.
If help-char is left set to ?\C-h things work fine because as a
convention keymaps avoid binding that due to it being the default
binding for help. That is just a convention, however, and things become
more difficult with a heavily user-customized set of keybindings that
preclude the use of ?\C-h for that purpose.
In that case, if ?\C-h cannot be used, it is much easier to find a
binding for help-char that is unlikely to conflict with any bindings if
it is permitted to use the full range of modifier keys.
This patch modifies which-key--next-page-hint, which is the only place
that broke when I set help-char to a keyboard event that wasn't a
character. Rather than doing a string comparison, help-char and prefix
keys are put in vectors and equality is checked that way.
Justin Burkett [Mon, 12 Jul 2021 18:52:52 +0000 (14:52 -0400)]
Remove more instances of obsolete variables.
Justin Burkett [Sun, 11 Jul 2021 01:08:08 +0000 (21:08 -0400)]
Merge remote-tracking branch 'origin/master'
Justin Burkett [Sun, 11 Jul 2021 01:03:55 +0000 (21:03 -0400)]
Remove some obsolete variables/functions
Justin Burkett [Tue, 6 Jul 2021 14:33:39 +0000 (10:33 -0400)]
Don't require evil in which-key-tests.el
Patch from Stefan Monnier
Justin Burkett [Wed, 30 Jun 2021 12:17:03 +0000 (08:17 -0400)]
Fix compiler warnings
Fixes #312
Justin Burkett [Wed, 30 Jun 2021 02:35:58 +0000 (22:35 -0400)]
Handle closure definition type
Fixes #311
Justin Burkett [Tue, 22 Jun 2021 17:20:40 +0000 (13:20 -0400)]
Improve which-key-add-keymap-based-replacements.
Also, teach which-key--safe-lookup-key to handle numeric results.
Justin Burkett [Tue, 22 Jun 2021 15:36:27 +0000 (11:36 -0400)]
Clarify usage of keymap replacements in docstrings and README
Justin Burkett [Tue, 22 Jun 2021 15:26:11 +0000 (11:26 -0400)]
Clean up some docstrings
Justin Burkett [Tue, 22 Jun 2021 15:22:32 +0000 (11:22 -0400)]
Clean up which-key--maybe-replace
Justin Burkett [Tue, 22 Jun 2021 11:37:04 +0000 (07:37 -0400)]
Improve which-key-add-keymap-based-bindings
Add a test
Justin Burkett [Tue, 22 Jun 2021 03:34:18 +0000 (23:34 -0400)]
Fix key sort order functions
We now always get the full key description (prefix + binding)
Justin Burkett [Tue, 22 Jun 2021 03:10:22 +0000 (23:10 -0400)]
Try again to fix tests
Justin Burkett [Tue, 22 Jun 2021 03:03:20 +0000 (23:03 -0400)]
Turn off fail-fast in github action
Justin Burkett [Tue, 22 Jun 2021 02:55:33 +0000 (22:55 -0400)]
Try without cask
Justin Burkett [Tue, 22 Jun 2021 02:40:54 +0000 (22:40 -0400)]
Add install python step to github action
Justin Burkett [Tue, 22 Jun 2021 02:32:23 +0000 (22:32 -0400)]
Fix which-key--group-p
length> is a new function maybe
Justin Burkett [Tue, 22 Jun 2021 02:25:15 +0000 (22:25 -0400)]
Try with cask again
Justin Burkett [Tue, 22 Jun 2021 02:15:34 +0000 (22:15 -0400)]
Fix github action
Justin Burkett [Mon, 21 Jun 2021 20:02:45 +0000 (16:02 -0400)]
Fix test
Justin Burkett [Mon, 21 Jun 2021 19:57:40 +0000 (15:57 -0400)]
Update README
Justin Burkett [Mon, 21 Jun 2021 19:51:22 +0000 (15:51 -0400)]
Make enable-extended-define-key obsolete
Justin Burkett [Mon, 21 Jun 2021 19:47:10 +0000 (15:47 -0400)]
Merge branch 'alt-get-bindings'
Justin Burkett [Mon, 21 Jun 2021 19:44:07 +0000 (15:44 -0400)]
Fix detection of named prefix bindings
Justin Burkett [Mon, 21 Jun 2021 19:07:36 +0000 (15:07 -0400)]
Fix menu-item bidning retrieval
Justin Burkett [Mon, 21 Jun 2021 18:55:05 +0000 (14:55 -0400)]
Fix prefix sorting
Justin Burkett [Mon, 21 Jun 2021 18:46:51 +0000 (14:46 -0400)]
Fix add-keymap-based-bindings and associated test
Justin Burkett [Mon, 21 Jun 2021 18:35:04 +0000 (14:35 -0400)]
Expand get-keymap-bindings test
Justin Burkett [Mon, 21 Jun 2021 18:09:18 +0000 (14:09 -0400)]
Fix type usage and arglists for new functions
Justin Burkett [Mon, 21 Jun 2021 18:00:54 +0000 (14:00 -0400)]
Fix default of which-key-replacement-alist
Justin Burkett [Mon, 21 Jun 2021 17:59:56 +0000 (13:59 -0400)]
Update tests
Justin Burkett [Mon, 21 Jun 2021 17:35:38 +0000 (13:35 -0400)]
Remove pseudo binding stuff
It's not necessary anymore with manual parsing of the keymaps
Justin Burkett [Mon, 21 Jun 2021 16:10:08 +0000 (12:10 -0400)]
Alternative approach to retrieving bindings (WIP)
Justin Burkett [Sat, 19 Jun 2021 22:22:42 +0000 (18:22 -0400)]
Merge pull request #305 from tarsiiformes/first-line
Improve first doc-string line in trivial cases
Jonas Bernoulli [Wed, 16 Jun 2021 23:24:17 +0000 (01:24 +0200)]
Improve first doc-string line in trivial cases
The first line of a doc-string should form a complete sentence.
Many doc-strings in this package do not follow that convention
but fixing them all would be difficult and is beyond the scope
of this commit. However, in a few cases the fix is trivial and
this commit tackles those instances.
Jonas Bernoulli [Tue, 15 Jun 2021 17:19:44 +0000 (19:19 +0200)]
Fix whitespace
Justin Burkett [Tue, 1 Jun 2021 02:52:43 +0000 (22:52 -0400)]
Fix whitespace
Justin Burkett [Tue, 1 Jun 2021 02:48:53 +0000 (22:48 -0400)]
Fix recent commit
Justin Burkett [Tue, 1 Jun 2021 02:34:08 +0000 (22:34 -0400)]
Fix README links
Justin Burkett [Tue, 1 Jun 2021 02:30:32 +0000 (22:30 -0400)]
Reference issues #93 and #175 in README
Fixes #291
Justin Burkett [Tue, 1 Jun 2021 02:21:44 +0000 (22:21 -0400)]
Merge pull request #303 from tarsiiformes/posframe
Support packages that use another frame to display bindings
Jonas Bernoulli [Sun, 30 May 2021 18:39:55 +0000 (20:39 +0200)]
Get which-key--buffer's window from any frame
Previously we assumed the buffer was being displayed in a window
of the current frame, which isn't the case if e.g. a child frame
is being used.
We also cannot assume that the third-party code that sets up such
a child frame also deletes it. `which-key-posframe' for example
merely hides it.
Jonas Bernoulli [Sun, 30 May 2021 18:18:50 +0000 (20:18 +0200)]
Cosmetics
Jonas Bernoulli [Sun, 30 May 2021 18:17:49 +0000 (20:17 +0200)]
Avoid code-duplication in which-key--hide-popup
Jonas Bernoulli [Sun, 30 May 2021 18:16:53 +0000 (20:16 +0200)]
Fix nesting-level of "God-mode" section
Jiangbin Zhao [Sun, 23 May 2021 21:07:53 +0000 (14:07 -0700)]
fix which-key--show-keymap for which-key-enable-extended-define-key
With which-key-enable-extended-define-key set to 't, given the keymap
and bindings below:
(setq a-map (make-sparse-keymap))
(bind-keys :map a-map
("a" . ("key 1" . command-1))
("b" . ("key b" . command-2)))
The output of (which-key--get-keymap-bindings a-map) was having
"unknown" as the key descriptions.
This change fixes it therefore allows the following to work as
expected:
(which-key--show-keymap "A map" a-map)
Frank Terbeck [Tue, 6 Apr 2021 15:18:16 +0000 (17:18 +0200)]
Unset header-line-format format in " *which-key*" buffer
Similarly to mode-line-format, header-line-format just takes up space and
currently also breaks window size calculations for the buffer. This sets
it to nil in order to suppress its display.
Signed-off-by: Frank Terbeck <ft@bewatermyfriend.org>
Celestial Nebula [Wed, 24 Mar 2021 18:21:16 +0000 (18:21 +0000)]
Update reference to obsolete variable in DOCSTRING (#285)
Justin Burkett [Sun, 31 Jan 2021 18:37:08 +0000 (13:37 -0500)]
Version 3.5.1
Justin Burkett [Wed, 16 Dec 2020 17:20:14 +0000 (12:20 -0500)]
Further simplify which-key--pseudo-key
Daniel Mendler [Tue, 15 Dec 2020 22:49:28 +0000 (23:49 +0100)]
simplify pseudo key
BlaCk_Void [Fri, 13 Nov 2020 01:22:08 +0000 (01:22 +0000)]
REAMDE code's Number of parentheses pairs (#270)
Justin Burkett [Mon, 19 Oct 2020 15:15:35 +0000 (11:15 -0400)]
Add tests for keymap-based-bindings
Justin Burkett [Sun, 18 Oct 2020 19:34:53 +0000 (15:34 -0400)]
Clarify README's description of keymap-based replacement
Justin Burkett [Tue, 8 Sep 2020 23:01:44 +0000 (19:01 -0400)]
Version 3.5.0
Justin Burkett [Tue, 8 Sep 2020 22:59:30 +0000 (18:59 -0400)]
Fix which-key--next-page-hint
prefix-keys might be a vector.
Fixes #265
Justin Burkett [Tue, 8 Sep 2020 18:18:21 +0000 (14:18 -0400)]
Hide paging hint when prefix is help-char
We can't do paging in this case.
Justin Burkett [Fri, 4 Sep 2020 20:06:48 +0000 (16:06 -0400)]
Improve keymap-based-replacement description in README
Ref #263
Justin Burkett [Wed, 2 Sep 2020 01:35:43 +0000 (21:35 -0400)]
Remove use of focus-{in,out}-hook
Fix #259 #260 #262
Justin Burkett [Fri, 28 Aug 2020 14:27:24 +0000 (10:27 -0400)]
Remove testing badge from README
Github integrates the results into the interface already, and it doesn't seem to
work.
Justin Burkett [Fri, 28 Aug 2020 14:24:31 +0000 (10:24 -0400)]
Stop testing against v24.5
It's old enough now
Justin Burkett [Fri, 28 Aug 2020 14:17:40 +0000 (10:17 -0400)]
Add which-key-add-keymap-based-replacements
This is an alternative to advising define-key using
which-key-enable-extended-define-key, but functions the same beneath the
surface.
Ref #226 #261
Rudi Grinberg [Mon, 17 Aug 2020 23:58:31 +0000 (07:58 +0800)]
Fix #257 (#258)
* Add test for #257
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
* Fix #257
Explicitly distinguish between replacing with `nil` and not replacing at
all.
I'm also simplifying the code by making all the branches more explicit.
This is a little longer, but makes all the clauses obvious.
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Rudi Grinberg [Fri, 17 Jul 2020 01:14:09 +0000 (18:14 -0700)]
Speed up which-key--maybe-replace
The first optimization is avoiding the intermediate list created by
append. Instead we just iterate over the two lists in turn
The second opimitization occurs where
which-key-allow-multiple-replacements is nil, in which case we can stop
the iteration once we've found a replacement
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Justin Burkett [Tue, 21 Jul 2020 14:16:25 +0000 (10:16 -0400)]
Add basic PR template
N V [Thu, 2 Jul 2020 02:19:37 +0000 (22:19 -0400)]
Fix which-key--propertize-description use make-text-button return value (#249)
As of:
https://github.com/emacs-mirror/emacs/commit/
7ac79872aed63110c0d26c1e62e1838d6101c9bd
make-text-button no longer modifies a string when it is passed as the
first argument. which-key--propertize-description relied on the mutation
of the string argument. Using the return value of make-text-button will
return the propertized string with both the new and old behavior.
Fixes #248
Justin Burkett [Sun, 16 Feb 2020 23:22:45 +0000 (18:22 -0500)]
Fix last commit